function afterTaxSalary(preTax) {
    this.basePoint = 2000; //个税起征点
    this.preTax = preTax; //税前月薪
    this.tax = 0; //应缴个税
    this.afterTax = 0; //税后月薪
    var rate = 0;
    var qcd = 0;
    if(this.preTax <= 2000) this.tax = 0;

    if (this.preTax <= 2500)
    {
        rate = 0.05;
        qcd = 0;
    }
    else if (this.preTax <= 4000)
    {
         rate = 0.10;
         qcd = 25;
    }
    else if (this.preTax <= 7000)
    {
         rate = 0.15;
         qcd = 125;
    }
    else if (this.preTax <= 22000)
    {
         rate = 0.20;
         qcd = 375;
    }
    else if (this.preTax <= 42000)
    {
         rate = 0.25;
         qcd = 1375;
    }
    else if (this.preTax <= 62000)
    {
         rate = 0.30;
         qcd = 3375;
    }
    else if (this.preTax <= 82000)
    {
         rate = 0.35;
         qcd = 6375;
    }
    else if (this.preTax <= 120000)
    {
         rate = 0.40;
         qcd = 10375;
    }
    else
    {
         rate = 0.45;
         qcd = 15375;
    }
    this.tax =  (this.preTax - 2000) * rate - qcd;
    if(this.tax < 0) this.tax = 0;
    this.afterTax = this.preTax - this.tax;
}

function preTaxSalary(afterTax) {
    this.preTax = 0; //税前月薪
    this.tax = 0; //应缴个税
    this.afterTax = afterTax; //税后月薪
    var rate = 0;
    var qcd = 0;
   if(this.afterTax <= 2000){
       this.preTax = 2000;
   }
   else if(this.afterTax <= 2475) {
       rate = 0.05;
       qcd = 0;
   }
    else if(this.afterTax <= 3825) {
        rate = 0.10;
        qcd = 25;
   }
    else if(this.afterTax <= 6375) {
        rate = 0.15;
        qcd = 125;
   }
    else if(this.afterTax <= 16775) {
        rate = 0.20;
        qcd = 375;
   }
    else if(this.afterTax <= 18357) {
        rate = 0.25;
        qcd = 1375;
   }
    else if(this.afterTax <= 33375) {
        rate = 0.30;
       qcd = 3375;
   }
    else if(this.afterTax <= 47375) {
        rate = 0.35;
        qcd = 6375;
    }
    else if(this.afterTax <= 60375) {
        rate = 0.35;
        qcd = 6375;
   }
    else if(this.afterTax <= 72375) {
        rate = 0.40;
       qcd = 10375;
   }
   else{
       rate = 0.45;
       qcd = 15375;
   }

    this.preTax = (this.afterTax - qcd - 2000*rate)/(1-rate);
    this.tax = this.preTax - this.afterTax;
    if(this.tax < 0 ) this.tax = 0;
}
